Creating pop-up menus

Creating a pop-up menu requires two steps:

Turning on the Track As Menu Item option in the Properties dialog box for all buttons in the pop-up menu. As a result, all other buttons in the menu can receive the mouse release events.
Enclosing the pop-up menu with a large button that closes the menu if the user rolls the pointer off the menu and releases the mouse button.

The following example explains how to create a very simple pop-up menu that can be used as the basis for something more complex. The instructions assume that you are familiar with creating button and movie clip symbols, and attaching actions to buttons and frames.

To create a button for use in a pop-up menu:

1 Create a new button symbol for the menu items.
2 Draw a filled white rectangle in the Up frame of the button symbol's Timeline.
3 Create a keyframe in the Over frame.
4 Fill the rectangle with a different color for the highlight color of menu items. You don't need to define the Down or Hit frames.

To create the pop-up menu movie clip:

1 Create a new movie clip symbol.
2 Place an instance of the button symbol you just created in the first frame of the movie clip.
3 Double-click the button, and then select the Actions tab in the Properties dialog box.
4 Click the + (plus), choose On MouseEvent from the pop-up menu, and select Press in the Parameters pane. With the On (Press) line selected, choose Go To from the pop-up menu. Specify Frame Number as the parameter and enter 1 in the box.
This action makes the movie clip go to the next frame when the user clicks the button. The next frame will show the open menu. Use the On (Press) condition because pop-up menus respond instantly when clicked, not when the mouse is released as do normal buttons.
5 Double-click the first frame in the Timeline, and select the Actions tab in the Frame Properties dialog box. Click the + (plus) and choose Go To from the pop-up menu. Choose Frame Number 1 as the parameter.
This makes the movie loop on frame 1 until the user clicks the button. Clicking the button sends the movie to frame 2.
6 Create a keyframe in frame 2.
7 Create several instances of the button symbol you made earlier. Arrange the instances in a column below the button you created in frame 1.
8 Use Modify > Align to align and evenly space the instances.
9 Add text labels to each button.
10 Double-click each button, including the top button you created in frame 1. Use the Instance Properties dialog box to do the following:
Click the Definition tab and select Track as Menu Item. (When set to Track as Menu Item, a clicked button allows other buttons to receive the mouse release event.)
Click the Actions tab and choose the statement that you want the menu item to run. Following this statement, choose a Go To statement that sends the movie clip back to the first frame. The action may look something like this:
On (Release)
	Toggle High Quality
	Go To and Stop (1)
End On 
The Go To statement closes the menu after the user makes a selection.
11 To test the pop-up menu, create an instance of the pop-up menu movie clip symbol and choose Control > Test Movie.

The pop-up menu works in most respects, except that it stays open when you open the menu and click somewhere off the menu.

To make the pop-up menu close when the user clicks outside the menu:

1 Create a new button symbol that is a rectangle the same size and color as the Stage.
Don't define a Down, Over, or Hit state for the button because you don't want the button to respond visibly to being clicked.
2 Open the movie in symbol-editing mode, and create a new layer underneath the layer you've been working in.
3 Create an instance of the large button you just made.
4 Double-click the button.
5 Turn on the Track as Menu Item option in the Instance Properties dialog box, and then attach a Go To statement that sends the movie clip back to frame 1.

To test the pop-up menu, create an instance of the pop-up menu symbol on the Stage and choose Control > Test Movie.